package com.nvc.homeplan;


import android.app.*;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;

public class HomePage  extends Activity
{
    private static final int MENU_CALL_REVIEW = Menu.FIRST + 2;
    private static final int MENU_MAP_REVIEW = Menu.FIRST + 1;
    private static final int MENU_WEB_REVIEW = Menu.FIRST; 
    
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.home_page);
    }
    
    public void homeButtonClickHandler(View target) 
    {
    	Intent intent;
    	HomePlanApplication application = (HomePlanApplication) getApplication();
    	application.searchType = "";
    	application.searchUrlQueryString = "";
    	application.cfmswitch = 1;
    	
    	switch (target.getId())
    	{
			case R.id.home_page_btn_multifamily_plans:
				intent = new Intent(Constants.INTENT_ACTION_MULTIFAMILY_PLAN_SEARCH_PAGE);
				startActivity(intent);
				break;
    	
			case R.id.home_page_btn_project_plans:
				intent = new Intent(Constants.INTENT_ACTION_PROJECT_PLAN_SEARCH_PAGE);
				startActivity(intent);
				break;
    	
			case R.id.home_page_btn_garage_plans:
				intent = new Intent(Constants.INTENT_ACTION_GARAGE_PLAN_SEARCH_PAGE);
				startActivity(intent);
				break;
    	
    		case R.id.home_page_btn_house_plans:
    	        intent = new Intent(Constants.INTENT_ACTION_HOUSE_PLAN_SEARCH_PAGE);
    	        startActivity(intent);
    			break;
    		
    		case R.id.home_page_btn_concept_plans:
    	        intent = new Intent(Constants.INTENT_ACTION_CONCEPT_PLAN_SEARCH_PAGE);
    	        startActivity(intent);
    			break;
    			
    		case R.id.home_page_btn_plan_books:
    	    	application.searchType = "PB";
    	    	application.searchUrlQueryString = "Planbook=1";
    	    	application.cfmswitch = 2;
    	        intent = new Intent(Constants.INTENT_ACTION_PLAN_LIST_PAGE);
    	        startActivity(intent);
    			
    	}
    }
    
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        super.onCreateOptionsMenu(menu);
        menu.add(0, HomePage.MENU_WEB_REVIEW, 0, "Home").setIcon(android.R.drawable.ic_menu_info_details);
        menu.add(0, HomePage.MENU_MAP_REVIEW, 1, "Plan Search").setIcon(android.R.drawable.ic_menu_mapmode);
        menu.add(0, HomePage.MENU_CALL_REVIEW, 2, "Blog").setIcon(android.R.drawable.ic_menu_call);
        return true;
    }    
}
